<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/templates/masterLayout.xhtml">
		<ui:define name="content">
			<h:form id="banListFormId">
				<p:dataTable id="banDataTableId" value="#{banView.dataModel}" selection="#{banView.selectedEntities}"
					paginator="true" var="entity" rows="10"
					paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
					lazy="true" paginatorPosition="bottom">
					<p:ajax event="rowDblselect" listener="#{banView.editAction}" partialSubmit="true" oncomplete="banDialog.show()"
						update=":banDetailFormId:banPanelGridId" />
					<f:facet name="header">
						<p:commandButton icon="ui-icon-plus" value="Tạo mới" action="#{banView.newAction}"
							actionListener="#{banView.reset}" update=":banDetailFormId:banPanelGridId" oncomplete="banDialog.show()"
							style="float:left" />
						<div style="clear: both;" />
					</f:facet>

					<p:column selectionMode="multiple" style="width:1%" />

					<p:column headerText="Mã số">
						<h:outputText value="#{entity.code}" />
					</p:column>

					<p:column headerText="Tên" sortBy="#{entity.name}">
						<h:outputText value="#{entity.name}" />
					</p:column>
					<p:column headerText="Khu vực" sortBy="#{entity.khuVuc.name}">
						<h:outputText value="#{entity.khuVuc.name}" />
					</p:column>
					<p:column headerText="Số chỗ ngồi" sortBy="#{entity.soChoNgoi}">
						<h:outputText value="#{entity.soChoNgoi}" />
					</p:column>
					<f:facet name="footer">
					</f:facet>
				</p:dataTable>

				<p:confirmDialog id="banDeleteConfirmDialogId" message="Bạn muốn xóa bàn?" header="Xác nhận xóa bàn"
					severity="alert" widgetVar="banDeleteConfirmDialog">

					<p:commandButton id="deleteYesId" value="Yes" update=":banListFormId:banDataTableId"
						oncomplete="banDeleteConfirmDialog.hide()" action="#{banView.deleteAction}" />
					<p:commandButton id="deleteNoId" value="No" immediate="true" onclick="banDeleteConfirmDialog.hide()" type="button" />
				</p:confirmDialog>
			</h:form>

			<ui:include src="banDetails.xhtml" />
		</ui:define>
	</ui:composition>


</ui:composition>